from faker import Faker

fake = Faker(locale="zh_cn")


# 生成10万份测试数据
def func1():
    for _ in range(100000):
        name = fake.name()
        email = fake.email()
        phone_number = fake.phone_number()
        address = fake.address()
        print(name, email, phone_number, address)


# 填充10万行数据
def func2(db):
    """
    :param db: 数据库
    """
    for _ in range(100000):
        name = fake.name()
        email = fake.email()
        phone_number = fake.phone_number()
        address = fake.address()
        # 插入数据库
        db.insert(name, email, phone_number, address)


# 生成虚拟用户数据
def func3():
    name = fake.name()
    address = fake.address()
    email = fake.email()
    phone_number = fake.phone_number()
    age = fake.random_int(min=18, max=90)
    sex = fake.random_element(elements=("男", "女"))

    print(f"姓名: {name}\n"
          f"地址: {address}\n"
          f"邮箱: {email}\n"
          f"手机号: {phone_number}\n"
          f"年龄: {age}\n"
          f"性别: {sex}")


if __name__ == '__main__':
    # func1()
    func3()
